#define entity #SYSTEM [系统]
#define entity #HIDDER [系统]
#define entity #SEEKER [系统]

# 获取全部总人数
execute store result score #SYSTEM MaxPlayer if entity @a
execute store result score #HIDDER MaxPlayer if entity @a[team=hidder]
execute store result score #SEEKER MaxPlayer if entity @a[team=seeker]

# 机关-心跳-1
execute if block -371 7 -673 minecraft:oak_button[powered=true] run function mc:level/1/on
execute if block -369 7 -672 minecraft:oak_button[powered=true] run function mc:level/1/on

#机关-心跳-2
execute if block -374 13 -674 minecraft:stone_button[powered=true] run function mc:level/2/on
execute if block -367 15 -672 minecraft:oak_button[powered=true] run function mc:level/2/on

#机关-心跳-3
execute if block -357 9 -687 minecraft:oak_button[powered=true] run function mc:level/3/on
execute if block -358 2 -687 minecraft:stone_button[powered=true] run function mc:level/3/on

#机关-心跳-4
execute if block -366 2 -686 minecraft:stone_button[powered=true] run function mc:level/4/on
execute if block -367 8 -686 minecraft:stone_button[powered=true] run function mc:level/4/on

# 最后4分钟发光10s
# execute if score #SYSTEM GameStart matches 1 if score #SYSTEM GameTimer_mm matches 3 run effect give @a[team=hidder] glowing 10 255 true

# 最后2分钟发光20s
execute if score #SYSTEM GameStart matches 1 if score #SYSTEM GameTimer_mm matches 1 run effect give @a[team=hidder] glowing 20 255 true

# 计时器
execute if score #SYSTEM GameStart matches 1 if score #SYSTEM Waittimer matches 1 run function mc:plugin/waittimer/timer
execute if score #SYSTEM GameStart matches 1 if score #SYSTEM GameTimer matches 1 run function mc:plugin/gametimer/timer
execute if score #SYSTEM GameStart matches 1 if score #SYSTEM GameTimer matches 1 run function mc:tell/timer/gametimer

#单名逃脱者阵亡-猎杀者获胜
execute if score #SYSTEM GameStart matches 1 if score #HIDDER MaxPlayer matches 1 if score #HIDDER MaxPlayer = #HIDDER hidder run function mc:defeat/hidder
execute if score #SYSTEM GameStart matches 1 if score #SYSTEM GameTimer matches 0 run function mc:defeat/seeker

# 永久夜视
effect give @a night_vision infinite 255 true